#define  _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

int arr[200][200] = { 0 };
int main()
{
    int row = 0, col = 0, i = 0, j = 0;
    scanf("%d %d", &row, &col);
    for (i = 0; i < row; i++)
    {
        for (j = 0; j < col; j++)
            scanf("%d", &arr[i][j]);
    }
    for (i = 0; i < col; i++)
    {
        for (j = 0; j < row; j++)
            printf("%d ", arr[j][i]);
        printf("\n");
    }

    return 0;
}